<!DOCTYPE html>
<html>
<head>
<style>
	* { font-family:Arial; }
	div { width:400px; height:100px; background:#eee; font-size:12px; margin-bottom:1px; }
</style>
<script>
	function getStyle(obj) {
		obj.innerHTML = '.style.cssText=' + (obj.style.cssText).toLowerCase() + 
			'<br>.getAttribute("style")=' + ("" + obj.getAttribute("style")).toLowerCase();
	}
	window.onload = function () {
		var d1 = document.getElementById("d1");
		var d2 = document.getElementById("d2");
		var styleText = "background-color:rgb(51, 204, 204); font-size:16px";
		d1.style.cssText = styleText;
		d2.setAttribute("style", styleText);
		getStyle(d1);
		getStyle(d2);
	}
</script>
</head>
<body>
	<div id="d1">d1</div>
	<div id="d2">d2</div>
</body>
</html>